package net.sppan.base.service.impl;

import net.sppan.base.common.utils.MD5Utils;
import net.sppan.base.dao.IEmployeeDao;
import net.sppan.base.dao.IUserDao;
import net.sppan.base.dao.support.IBaseDao;
import net.sppan.base.entity.Employee;
import net.sppan.base.entity.Resource;
import net.sppan.base.entity.Role;
import net.sppan.base.entity.User;
import net.sppan.base.service.EmployeeService;
import net.sppan.base.service.IRoleService;
import net.sppan.base.service.IUserService;
import net.sppan.base.service.support.impl.BaseServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/** 
 * @Description: 职工
 * @Param:  
 * @return:  
 * @Author:
 */
@Service
public class EmployeeServiceImpl  implements EmployeeService {
    @Autowired
    private IEmployeeDao iEmployeeDao;
	@Override
	public List<Employee> getEmployeeList(String employeeName) {
		List<Employee> list =  iEmployeeDao.getEmployeeList(employeeName);
		return list;
	}

	@Override
	public void saveEmployee(Employee employee) {

		Employee entity = iEmployeeDao.getEmployee(employee.getId());

		if(entity != null){
			//更新
			iEmployeeDao.updateEmployee(employee);
		}else{
			//新增
			iEmployeeDao.saveEmployee(employee);
		}

	}

	@Override
	public Employee getEmployee(Integer employeeId) {
		return iEmployeeDao.getEmployee(employeeId);
	}

	@Override
	public int deleteEmployee(Integer id) {
		return iEmployeeDao.deleteEmployee(id);
	}
}
